//
//  LpLeftTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/6/15.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "LpLeftTableViewCell.h"

@interface LpLeftTableViewCell ()
/**  tupian  */
@property (strong, nonatomic) UIImageView  *lpImageView;
/**  wenzi  */
@property (strong, nonatomic) UILabel  *lpLabel;

@end
@implementation LpLeftTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addSubview:self.lpImageView];
        [self addSubview:self.lpLabel];
        self.lpImageView.sd_layout
        .centerYEqualToView(self)
        .leftSpaceToView(self, 20 * [UIScreen zj_screenWScale])
        .heightIs(25 * [UIScreen zj_screenHScale])
        .widthIs(25 * [UIScreen zj_screenHScale]);
        
        self.lpLabel.sd_layout
        .centerYEqualToView(self)
        .leftSpaceToView(self.lpImageView, 15 * [UIScreen zj_screenWScale])
        .heightIs(20 * [UIScreen zj_screenHScale])
        .widthIs(150 * [UIScreen zj_screenWScale]);
        
        
        UIView *under = [UIView new];
        under.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:under];
        under.sd_layout.leftEqualToView(self).bottomEqualToView(self).widthIs([UIScreen zj_screenWith]).heightIs(1);
    }
    return self;
}

- (void)setData:(NSDictionary *)data{
    _data = data;
    self.lpImageView.image = [UIImage imageNamed:data[@"image"]];
    self.lpLabel.text = data[@"title"];
}
- (UIImageView *)lpImageView{
    if (!_lpImageView) {
        _lpImageView = [UIImageView new];
        _lpImageView.contentMode = UIViewContentModeCenter;
    }
    return _lpImageView;
}

- (UILabel *)lpLabel{
    if (!_lpLabel) {
        _lpLabel = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor textGrayColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = LYPFONT(16);
            label;
        });
    }
    return _lpLabel;
}

@end
